//------------------------------------------------------------------------------
#include <QtDebug>
#include "CGestionFavorisFrm.h"
#include "CMyTreeWidgetItemData.h"
//------------------------------------------------------------------------------
CGestionFavorisFrm::CGestionFavorisFrm(QWidget *parent) : QDialog(parent) {
	setupUi(this);
}
//------------------------------------------------------------------------------
void CGestionFavorisFrm::dropFavoris(QTreeWidgetItem * item) {
	int i;

	for(i=0;i<item->childCount();i++) {
		QTreeWidgetItem *c=item->child(i); 
		
		dropFavoris(c);
		
		item->removeChild(c);
		delete c;
	}
}
//------------------------------------------------------------------------------
QTreeWidgetItem *  CGestionFavorisFrm::createRacine(int id) {
	QStringList infos;
	CMyTreeWidgetItemData data(id, CMyTreeWidgetItemData::dtRoot);
	
	infos << "Racine";
	
	QTreeWidgetItem *nItem=new QTreeWidgetItem(infos);
	
	nItem->setIcon(0, QIcon(":coMexpert/images/folder.png"));
	nItem->setData(0, Qt::UserRole, QVariant::fromValue(data));
	
	treeFavoris->insertTopLevelItem(0, nItem);
	
	return treeFavoris->topLevelItem(0);
}
//------------------------------------------------------------------------------